<template>
	<view class="container">
		<com-head textTit="核对信息" :typeVal="1" :scrollTop="scrollTop"></com-head>
		
		
		<view class="groupList">
			<view class="list">
				<text class="tit">发票类型</text>
				<text class="txt">电子发票（{{params.type == 1 ? "专票": "普票"}}）</text>
			</view>
			<view class="list">
				<text class="tit">抬头名称</text>
				<text class="txt">{{params.rise_name}}</text>
			</view>
			<view class="list">
				<text class="tit">发票金额</text>
				<text class="txt">¥{{params.price}}</text>
			</view>
			<view class="list">
				<text class="tit">申请时间</text>
				<text class="txt">{{$u.timeFormat(date, 'yyyy-mm-dd')}}</text>
			</view>
			<view class="list" v-if="params.rise_type == 1">
				<text class="tit">公司税号</text>
				<text class="txt">{{params.identification}}</text>
			</view>
			<view class="list" v-if="params.type == 1">
				<text class="tit">公司地址</text>
				<text class="txt">{{params.address}}</text>
			</view>
			<view class="list" v-if="params.type == 1">
				<text class="tit">公司电话</text>
				<text class="txt">{{params.phone}}</text>
			</view>
			<view class="list" v-if="params.type == 1">
				<text class="tit">开户银行</text>
				<text class="txt">{{params.bank}}</text>
			</view>
			<view class="list" v-if="params.type == 1">
				<text class="tit">银行账号</text>
				<text class="txt">{{params.account}}</text>
			</view>
		</view>
		<view class="groupList">
			<view class="list">
				<text class="tit">发送地址</text>
				<text class="txt">{{params.send_address}}</text>
			</view>
		</view>
		<view class="submit" @click="submit()">
			提交申请
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				params:{},
				date:"",
				scrollTop: 0
			}
		},
		onPageScroll(e){
			this.scrollTop = e.scrollTop
		},
		async onLoad() {
			this.params = JSON.parse(uni.getStorageSync('invoiceInfo'));
			console.log(this.params,"8888888")
			this.date = Date.parse(new Date())/1000;
			console.log(this.date)
		},
		methods: {
			async submit(){
				let params
				if(this.params.kind == 1){
					params={
						account: this.params.account,
						address: this.params.address,
						bank: this.params.bank,
						company_id:this.params.company_id,
						identification:this.params.identification,
						orders_id: this.params.orders_id,
						phone: this.params.phone,
						remarks:this.params.remarks,
						rise_name: this.params.rise_name,
						rise_type: this.params.rise_type,
						send_address: this.params.send_address,
						send_type: this.params.send_type,
						type: this.params.type,
					}
					let {data,code} = await this.$u.api.setInvoice(params);
					if(code){
						this.utlis.goUrl(`/pages/mine/submitSuccess?type=2`)
					}
				}else{
					params={
						account: this.params.account,
						address: this.params.address,
						bank: this.params.bank,
						company_id:this.params.company_id,
						identification:this.params.identification,
						user_price_id: this.params.orders_id,
						phone: this.params.phone,
						remarks:this.params.remarks,
						rise_name: this.params.rise_name,
						rise_type: this.params.rise_type,
						send_address: this.params.send_address,
						send_type: this.params.send_type,
						type: this.params.type,
						user_id: this.userInfo.id,
					}
					let {data,code} = await this.$u.api.userSetInvoice(params);
					if(code){
						this.utlis.goUrl(`/pages/mine/submitSuccess?type=2`)
					}
				}
				// return
			}
		}
	}
</script>

<style lang="scss" scoped >
.container{
	padding: 50rpx 32rpx;
	.submit{
		width: calc(750rpx - 32rpx - 32rpx);
		line-height: 100rpx;
		background: linear-gradient(140deg,#50DCC2 0%, #007664);
		border-radius: 48rpx;
		text-align: center;
		color: #FFFFFF;
		font-size: 32rpx;
		margin-top: 200rpx;
	}
	.groupList{
		background-color: #FFFFFF;
		border-radius: 8rpx;
		padding: 0 32rpx;
		margin-bottom: 30rpx;
		.list{
			display: flex;
			align-items: center;
			height: 96rpx;
			justify-content: space-between;
			border-bottom: 1rpx solid rgba(142,142,142,.24);
			color: #333333;
			font-size: 28rpx;
		}
		.list:last-child{
			border-bottom: 1rpx solid #F6F7FA;
		}
	}
}
</style>
<style >
page{
	background-color: #F6F7FA;
}
</style>
